#ifndef __SCNS_TIMER_H__
#define __SCNS_TIMER_H__

#include "ScnsConfig.h"

#if defined(SCNS_TIMER_ENABLE)&&SCNS_TIMER_ENABLE==1

#include "ScnsYing.h"
#include "ScnsBspTimer.h"

#define scnsTimerGetFpsByUs(us)     (1000000ULL/((us)+1))
#define scnsTimerGetFps(us)         scnsTimerGetFpsByUs(us)
#define scnsTimerGetFpsByTick(tick) scnsTimerGetFpsByUs(scnsTimerGetUsByTick(tick))

extern ScnsStatus scnsTimerInit(void);
extern void scnsTimerMarkInited(void);

extern void scnsTimerSetTick(uint64 tick);
extern uint64 scnsTimerGetTick(void);
extern uint64 scnsTimerGetInitedTick(void);

extern void scnsDelayNs(uint64 ns);
extern void scnsDelayUs(uint64 us);
extern void scnsDelayMs(uint64 ms);

extern uint64 scnsTimerGetNsByTick(uint64 tick);
extern uint64 scnsTimerGetUsByTick(uint64 tick);
extern uint64 scnsTimerGetMsByTick(uint64 tick);

extern uint64 scnsTimerGetTickByNs(uint64 ns);
extern uint64 scnsTimerGetTickByUs(uint64 us);
extern uint64 scnsTimerGetTickByMs(uint64 ms);

extern uint64 scnsTimerGetNs(void);
extern uint64 scnsTimerGetUs(void);
extern uint64 scnsTimerGetMs(void);

extern uint64 scnsTimerGetInitedNs(void);
extern uint64 scnsTimerGetInitedUs(void);
extern uint64 scnsTimerGetInitedMs(void);

extern void scnsTimerTest(void);

extern void scnsTimerSysTickHandler(void);

#endif
#endif
